#include <stdio.h>
#include <stdlib.h>
#include "carga.h"

char *carga(void)
{

	char *file;
	char c;
	int i=0;
	
	
	file=malloc(sizeof(char));
	if (file==NULL)
	{
		perror("malloc");
		return NULL;
	}
	scanf("%c",&c);
	while (c=='\n')
	{
		scanf("%c",&c);
	}
	
	file[i]=c;
	i++;
	
	while(c!='\n')
	{
		file=realloc(file,sizeof(char)*(i+1));
		if (file==NULL)
		{
			perror("malloc");
			return NULL;
		}
		scanf("%c",&c);
		file[i]=c;
		i++;
	}
	file[i-1]='\0';

	return file;
}
